<div class="topBar">
      <div class="topTitle">添加艺术品</div>
      <div class="topButton"><a href="/admin/manage-artwork" target="_self">放弃</a></div>
    </div>
	
<?php echo $this->form;?>

<script>
function getRelationalArtworks(){
	var theArtworkId = $("#id").val();
	var theArtistId = $("#artist").val();

	$("#relational_works-label").replaceWith("");
	$.get(
		"/admin/get-related-artworks/artistId/"+theArtistId+"/artworkId/"+theArtworkId,
		{},
		function(data){
			$("#relational_works-element").replaceWith(data); 
			changeRelationalWorkStyle();
		}
	);

}

function changeRelationalWorkStyle(){
	var html = $('#relational_works-element').html();
	var r1 = html.replace(/\<label for/g, '<li><label for');
	var r2 = r1.replace(/\<br\>/g, '</li>');
	$('#relational_works-element').html('<div><ul class="multicol">'+r2+'</ul></div><div style="clear:both"></div>');
}

function changeStylesStyle(){
	var html = $('#style-element').html();
	var r1 = html.replace(/\<label for/g, '<li><label for');
	var r2 = r1.replace(/\<br\>/g, '</li>');
	$('#style-element').html('<div><ul class="multicol">'+r2+'</ul></div><div style="clear:both"></div>');
}

function changeTagsStyle(){
	var html = $('#tags-element').html();
	var r1 = html.replace(/\<label for/g, '<li><label for');
	var r2 = r1.replace(/\<br\>/g, '</li>');
	$('#tags-element').html('<div><ul class="multicol">'+r2+'</ul></div><div style="clear:both"></div>');
}

function changeSubjectsStyle(){
	var html = $('#subject-element').html();
	var r1 = html.replace(/\<label for/g, '<li><label for');
	var r2 = r1.replace(/\<br\>/g, '</li>');
	$('#subject-element').html('<div><ul class="multicol">'+r2+'</ul></div><div style="clear:both"></div>');
}

function getOtherPrice(){
	var rmb_price = $("#rmb_price").val();
	$.get(
			"/admin/get-other-price/price/"+rmb_price,
			{},
			function(data){
				//alert(data.uro_price);
				$("#uro_price").val(data.uro_price); 
				//alert($("#uro_price").val());

				//alert(data.usd_price);
				$("#usd_price").val(data.usd_price); 
				//alert($("#usd_price").val());
				
				
			}
		);
}

$(document).ready(function(){
	getRelationalArtworks();
	changeStylesStyle();
	changeTagsStyle();
	changeSubjectsStyle();

}); 
</script>

